package com.singzi.leetcode.N2100;

import java.util.Arrays;

public class T2022 {
    public static void main(String[] args) {
        int[] nums = {1,2,3,4};
        Solution2022 solution2022 = new Solution2022();
        System.out.println(Arrays.deepToString(solution2022.construct2DArray(nums, 2, 2)));

    }
}
class Solution2022 {
    public int[][] construct2DArray(int[] original, int m, int n) {
        if(original.length!=m*n) return new int[][]{};

        int [][]result = new int[m][n];
        for (int i = 0; i < original.length; i++) {
            result[i/n][i%n] = original[i];
        }
        return  result;
    }
}